layui.use(['upload', 'element', 'layer'], function() {
    var $ = layui.jquery,
        upload = layui.upload,
        element = layui.element,
        layer = layui.layer;

    //上传资质
    upload.render({
        elem: '#chooseImg',
        url: 'http://192.168.8.109/home/login/testUpFile' //改成您自己的上传接口
            ,
        multiple: true,
        before: function(obj) {
            //预读本地文件示例，不支持ie8
            var str = "";
            obj.preview(function(index, file, result) {
                $('#show_upload_img').append('<img src="' + result + '">')
            });
            // console.log(str)
        },
        done: function(res) {
            var chooseUrl = $("#chooseUrl").val();
            var url = res.data.file;
            var newUrl = chooseUrl + '++' + url;
            var resultUrl = jQuery.trim(newUrl, "++");
            $("#chooseUrl").val(resultUrl);
            // console.log(res)
            //上传完毕
        }
    });
    //征信信息
    var uploadInst = upload.render({
            elem: '#chooseImg1',
            url: 'http://192.168.8.109/home/login/testUpFile' //改成您自己的上传接口
                ,
            before: function(obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result) {
                    $('#show_upload_img1').html("");
                    $("#chooseUrl1").val("")
                    $('#show_upload_img1').append('<img src="' + result + '">')
                        //$('#show_upload_img2').after($("<img  src='" + result + "' />")); //图片链接（base64）
                });
            },
            done: function(res) {
                var url = res.data.file;
                $("#chooseUrl1").val(url);
            }
        })
        //体检报告
    var uploadInst = upload.render({
            elem: '#chooseImg2',
            url: 'http://192.168.8.109/home/login/testUpFile' //改成您自己的上传接口
                ,
            before: function(obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result) {
                    $('#show_upload_img2').html("");
                    $("#chooseUrl2").val("")
                    $('#show_upload_img2').append('<img src="' + result + '">')
                        //$('#show_upload_img2').after($("<img  src='" + result + "' />")); //图片链接（base64）
                });
            },
            done: function(res) {
                var url = res.data.file;
                $("#chooseUrl2").val(url);
            }
        })
        //图像
    var uploadInst = upload.render({
        elem: '#zhaopian',
        url: 'http://192.168.8.109/home/login/testUpFile' //改成您自己的上传接口
            ,
        before: function(obj) {
            //预读本地文件示例，不支持ie8
            obj.preview(function(index, file, result) {
                $("#zhaopian").attr("src", result);
                // $('#zhaopian').after($("<img  src='" + result + "' />")); //图片链接（base64）
            });
        },
        done: function(res) {
            var url = res.data.file;
            $("#zhaopian_url").val(url);
        }
    })
})